import { reqSpuList } from "@/api/product/spu"

const state = {
    spuList: {}
}
const mutations = {
    RECEIVE_SUPLIST(state, data) {
        state.spuList = data
    }
}
const actions = {
    async getSpuList({ commit }, { page, limit, levelThreeId }) {
        const result = await reqSpuList(page, limit, levelThreeId)
        if (result.code == 200) {
            commit("RECEIVE_SUPLIST", result.data)
        } else {
            return Promise.reject(new Error(result.message))
        }
    }
}
export default {
    namespaced: true,
    state, mutations, actions
}